package gof.com.yew.prototype;

/**
 * 深拷贝
 * @author yw
 */
public class PrototypeDemo02 {
	
	public static void main(String[] args) throws Exception {
		Address1 address = new Address1("中国", "湖北"); 
		Sheep1 sheep = new Sheep1("多利", address);
		Sheep1 sheep1 = (Sheep1)sheep.Clone();
		System.out.println(sheep.getName());
		System.out.println(sheep.getAddress().getCuntry());
		System.out.println(sheep.getAddress().getLoc());
		System.out.println("-------------------------------------------------");
		System.out.println(sheep1.getName());
		System.out.println(sheep1.getAddress().getCuntry());
		System.out.println(sheep1.getAddress().getLoc());
		System.out.println("-------------------------------------------------");
		address.setLoc("浙江");
		System.out.println(sheep.getAddress().getLoc());
		System.out.println(sheep1.getAddress().getLoc());
	}

}
